package com.mzpai.product.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mzpai.product.constant.ProductConstants;
import com.mzpai.product.mapper.StoreProductAttrValueMapper;
import com.mzpai.product.model.StoreProductAttrValue;
import com.mzpai.product.service.StoreProductAttrValueService;
import com.mzpai.service.impl.BaseServiceImpl;
/**
 *
 * <b>商品品牌 | Service</b><br>
 *
 * guguanfei 2021-03-16 18:48:49
 * 
 *  @version 1.0.0
 *
 */
@Service
public class StoreProductAttrValueServiceImpl extends BaseServiceImpl<StoreProductAttrValue> implements StoreProductAttrValueService {

	Logger logger = LoggerFactory.getLogger(StoreProductAttrValueServiceImpl.class);

	@Autowired 
	private StoreProductAttrValueMapper mapper;

	@Override
	public void deleteByProductIdAndType(Integer productId,Integer type) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("productId", productId);
		map.put("type", type);
		mapper.deleteByProductIdAndType(map);
		
	}

	@Override
	public List<StoreProductAttrValue> getListByProductId(Integer productId) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("productId", productId);
		map.put("type", ProductConstants.ACTIVE_TYPE_0);
		return mapper.getList(map);
	}

	@Override
	public void updateProductIdAndType(StoreProductAttrValue storeProductAttrValue) {
		mapper.updateProductIdAndType(storeProductAttrValue);
	}

	@Override
	public void syncProduct(int productId) {
		mapper.syncProduct(productId);
	}

	@Override
	public StoreProductAttrValue queryByPrimaryId(Integer id) {
		StoreProductAttrValue storeProductAttrValue=mapper.queryByPrimaryId(id);
		return storeProductAttrValue;
	}

	@Override
	public void updateByProductId(StoreProductAttrValue storeProductAttrValue) {
		mapper.updateByProductId(storeProductAttrValue);
	}
}